Chris Pollett > Old Classes > CS174
( Print View )

Student Corner:
  [Submit Sec2]
  [Grades Sec2]

  [Submit Sec3]
  [Grades Sec3]

  [
Lecture Notes]
  [Discussion Board]

Course Info:
  [Texts & Links]
  [Description]
  [Course Outcomes]
  [Outcomes Matrix]
  [Course Schedule]
  [Grading]
  [Requirements/HW/Quizzes]
  [Class Protocols]
  [Exam Info]
  [Regrades]
  [University Policies]
  [Announcements]

HW Assignments:
  [Hw1]  [Hw2]  [Hw3]
  [Hw4]  [Hw5]  [Quizzes]

Practice Exams:
  [Midterm]  [Final]

                           












CS174 Fall 2016Practice Midterm

To study for the midterm I would suggest you: (1) Know how to do (by heart) all the practice problems. (2) Go over your notes at least three times. Second and third time try to see how much you can remember from the first time. (3) Go over the homework problems. (4) Try to create your own problems similar to the ones I have given and solve them. (5) Skim the relevant sections from the book. (6) If you want to study in groups, at this point you are ready to quiz each other. The practice midterm is below. Here are some facts about the actual midterm: (a) It is closed book, closed notes. Nothing will be permitted on your desk except your pen (pencil) and test. (b) You should bring photo ID. (c) There will be more than one version of the test. Each version will be of comparable difficulty. (d) One problem (less typos) on the actual test will be from the practice test.

  1. Give an example of a minimal HTTP/1.0 request (1pt). Give an example minimal HTTP/1.1 request (1pt). Give an example of a common request header not needed in a minimal request (1pt). Give an example HTTP response to a simple get request (1pt).
  2. Give an example validating UTF-8, HTML 5 document with title "Practice Makes Perfect" (1pt). It should have meta tags so that search engines don't display snippets underneath links to this page in search results (1pt). The body should have an h1 tag (1pt) and you should have an ordered list (1pt).
  3. Imagine you designing the homepage for the class CS 666 Using Computers for Constant Assessment. The work for this class consists of 1000 short homeworks Hw1, ... Hw1000 each worth 0.1pts. Write a short PHP program which outputs an HTML 5 table (1pt) with table headings Grade Component, Value (1pt) and beneath this rows for each of the homeworks and how much they are worth (2pts).
  4. Briefly define and given an example of each of the following concepts (1pt each): (a) CSS Class Selector, (b) CSS Pseudo-selector, (c) Box Model, (d) fixed positioning.
  5. Explain the Model View Adapter design pattern (2pts). Explain the difference between this pattern and the MVC design pattern (2pts).
  6. Give the PHP needed to connect to a MySQL database named MyDatabase on localhost using the default port, username, and password using the mysqli interface. Your script should after connecting, create a table MY_TABLE with a single integer column MY_NUMBER. It should insert one row with value 3 then it should update this row to set the value to 8. Finally, your script should query this table to get all the rows (just 1) back.
  7. Briefly explain the HTTP involved in setting and sending a cookie (1pt). Give the PHP commands to send a HTTP header (1pt). Explain how PHP setcookie function works (1pt). How do sessions in PHP make use of Cookies? (1pt).
  8. With regard to databases, what is a functional dependency? (1pt) What is a trivial functional dependency? (1pt). What is BCNF? (1pt) Give an example of a database schema in BCNF and one which is not in BCNF (1pt).
  9. Write a PHP function noMoreShivering($too_cold) which return a string in which all occurrences of b followed by 1 or more r's that occur in $too_cold have been replaced with the empty string, leaving the string otherwise unchanged.
  10. Write a short PHP program which checks if the $_REQUEST variable is empty or not (1pt). If it is empty it outputs a HTML 5 web page with a form that uses method POST, has one textfield of name stuff, and a submit button (1pt). Beneath the form the web page should have an h2 tag, Old Stuff, and beneath this a div tag with the contents of the file OldStuff.txt (1pt). If the $_REQUEST variable was not empty, your script should write in an h1 tag, Storing!. If the $_REQUEST fields stuff field is set, your should then put the contents of this field into the file OldStuff.txt. (1pt)